package net.googlecode.kharchenko.dao.impl;

import net.googlecode.kharchenko.dao.InfPortionDAO;
import net.googlecode.kharchenko.models.InfPortion;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
import javax.persistence.Query;



@Repository
public class InfPortionDAOImpl implements InfPortionDAO {


    private EntityManager entityManager;

    @PersistenceContext
    public void setEntityManager(EntityManager entityManager) {

        this.entityManager = entityManager;
    }


    public List<InfPortion> getAllInfo() {

       Query query=entityManager.createQuery("Select info from InfPortion info");
       List<InfPortion> result= query.getResultList();
       return result;
    }

}
